//last key pressed
int c;
do {
	//draw map
	for (int yy=0;yy<10;yy++)
		for (int xx=0;xx<15;xx++)
			mvaddch(yy,xx,map[yy][xx]);
		
	//move player if there is no wall on the way
	if (KEY_UP==c && ' '==map[y-1][x])
		y--;
	if (KEY_DOWN==c && ' '==map[y+1][x])
		y++;
	if (KEY_LEFT==c && ' '==map[y][x-1])
		x--;
	if (KEY_RIGHT==c && ' '==map[y][x+1])
		x++;
		
	//draw player
	mvaddch(y,x,'@');
//quit when ESC is pressed
} while((27!=(c=getch())));
